

package org.pub.lunch.mashup.google.js;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Kyungseop Kim
 *
 */
public class JSArray {

	private List<String> list;
	
	public JSArray() {
		list = new ArrayList<String>();
	}
	
	public JSArray(String src) {
		list = new JSOTokenizer(src).getArray();
	}
	
	public List<String> items() {
		return list;
	}
	
	public String item(int index) {
		return list.get(index);
	}
	
	public int length() {
		return list.size();
	}
	
	public String getString(int index) throws Exception {
		return JSUTF8.convertJSUTF8(JSOTokenizer.unquote(item(index)));
	}
	
	public JSObject getObject(int index) {
		return new JSObject(item(index));
	}
}
